import urllib.request
import urllib.parse
import json


def post_json(url, content):
    headers = {"Content-Type": 'application/json'}
    data = bytes(json.dumps(content),'utf8')
    request = urllib.request.Request(url=url, data=data, headers=headers)
    return urllib.request.urlopen(request).read().decode('utf-8')


data = {"msgtype": "text", "text": {"content": "123456"}}
url = "https://oapi.dingtalk.com/robot/send?access_token=b9f5c57b177bf8a22739f10f1d88e141071f2fd7df32e3c18b0e735f6f2a4029"
print(post_json(url,data))
